Francisco Rodriguez-Sanchez
@frod_san
2015-11-14
plot(gmap(occdata, type = "satellite"))
points(occdata, col = "red", pch=20, cex = 2)
| species | lon | lat | |
|---|---|---|---|
| 1 | Solanum acaule Bitter | -66.10 | -21.90 |
| 2 | Solanum acaule Bitter | -71.00 | -13.50 |
| 52 | Solanum acaule Bitter | -66.43 | -24.22 |
| 53 | Solanum acaule Bitter | -72.07 | -13.35 |
| 54 | Solanum acaule Bitter | -68.97 | -15.23 |
| 55 | Solanum acaule Bitter | -64.95 | -17.75 |
coordinates(occs) <- c("lon", "lat")
str(occs, 2)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 49 obs. of 1 variable:
..@ coords.nrs : int [1:2] 2 3
..@ coords : num [1:49, 1:2] -66.1 -71 -66.4 -72.1 -69 ...
.. ..- attr(*, "dimnames")=List of 2
..@ bbox : num [1:2, 1:2] -72.5 -24.2 -64.7 -12.5
.. ..- attr(*, "dimnames")=List of 2
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
crs(occs) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
plot(gmap(occs, type = "satellite"))
points(Mercator(occs), col = "red", pch = 20, cex = 2)
occs <- shapefile("occs.shp")
plot(gmap(occs, type = "satellite"))
points(Mercator(occs), col = "red", pch = 20, cex = 2)
library(ggmap)
map <- get_map(bbox(occs), maptype = "watercolor", source = "stamen")
ggmap(map) +
geom_point(aes(x = coords.x1, y = coords.x2), data = as.data.frame(coordinates(occs)),
colour = "red", size = 4)
elevation <- getData("alt", country = "ESP")
library(rasterVis)
levelplot(elevation)
library(mapview)
mapView(occs)
e.g. RStoolbox
Fully-reproducible scripts
Harness all R stats power
Easy!
spgrass6RSAGAIncludes calling R from ArcGIS too